package com.tfswx.fljdmxyy.api;

import com.tfswx.fljdmxyy.dto.gnjk.GnjkAddInputDTO;
import com.tfswx.fljdmxyy.dto.gnjk.GnjkAddOutputDTO;
import com.tfswx.fljdmxyy.dto.gnjk.GnjkDeleteInputDTO;
import com.tfswx.fljdmxyy.dto.gnjk.GnjkUpdateInputDTO;
import com.tfswx.fljdmxyy.query.gnjk.GnjkQueryParam;
import com.tfswx.fljdmxyy.query.gnjk.GnjkQueryResult;
import com.tfswx.fljdmxyy.service.GnjkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 功能接口
 *
 * @author: 陈涛
 * @date: 2022-11-11
 **/
@Slf4j
@RestController
@RequestMapping(value = "api/gnjk")
@Api(tags = "功能接口")
public class GnjkController {

    @Resource
    private GnjkService gnjkService;

    @ApiOperation("新增功能接口")
    @PostMapping(value = "/addGnjk")
    public GnjkAddOutputDTO addGnfl(@RequestBody @Validated GnjkAddInputDTO dto) {
        return gnjkService.addGnfl(dto);
    }

    @ApiOperation("删除功能接口")
    @PostMapping(value = "/deleteGnjk")
    public Boolean deleteGnjk(@RequestBody @Validated GnjkDeleteInputDTO dto) {
        return gnjkService.deleteGnjk(dto);
    }

    @ApiOperation("修改功能接口")
    @PostMapping(value = "/updateGnjk")
    public Boolean updateGnjk(@RequestBody @Validated GnjkUpdateInputDTO dto) {
        return gnjkService.updateGnjk(dto);
    }

    @ApiOperation("查询功能接口")
    @PostMapping(value = "/queryGnjk")
    public List<GnjkQueryResult> queryGnjk(@RequestBody @Validated GnjkQueryParam param) {
        return gnjkService.queryGnjk(param);
    }
}
